/**
 * 新增履历
 * 工程项目名称：青州市民卡核心系统
 * 方法名：卡参数管理模块
 * 版本： ver 1.0  初版
 * 创建日期：20190319
 * 创建人：鱼洲杰
 */
//*******************卡产品管理*****************************************************
//获取卡产品信息回调函数
function getCardProductD(json){
	if(json.statusCode==DWZ.statusCode.error){
		navTabAjaxDone(json)
	}else{
	var content="";
	//$("#producttasked").html();
	var list;
	$(json).each(function(n,item){
		var numPerPage=item.numPerPage;
		var currentPage=item.currentPage;
		var totalCount=item.totalCount;
		var pageCount=item.pageCount
		var list=item.list;
		var flag = ["未启用","启用"];
		var flags = ["启用","未启用"];
		var point= ["普通","特殊"];
		if(list.length==0){
			content+="<tr><td colspan='8' align='center' >未查询到数据</td></tr>"
		}else{
			for(var i=0;i<list.length;i++){
				if(list[i].allowCoc==0){
					list[i].cocReleaseDays="";
				}
				if(list[i].allowChc==0){
					list[i].chcReleaseDays="";
				}
				var value="id:"+list[i].id+","+"cardTypeName:"+list[i].cardTypeName+","+"cardpName:"+list[i].cardpName+","+"validStatus:"+list[i].validStatus+","
				          +"cardValidTime:"+list[i].cardValidTime+","+"busAppFlag:"+list[i].busAppFlag+","+"bicycleAppFlag:"+list[i].bicycleAppFlag+","
				          +"libraryAppFlag:"+list[i].libraryAppFlag+","+"smallConsumptionAppFlag:"+list[i].smallConsumptionAppFlag+","
				          +"cardpCode:"+list[i].cardpCode;
				content+="<tr onmouseover='moveoverMouse(this)' onmouseout='moveoutMouse(this)' align='center' align='center'>"
					     +"<td><input name='producttasked' onclick='test(this)' value="+value+" type='radio'></td>"
					     +"<td>"+[i+1]+"</td>"
					     +"<td>"+list[i].cardTypeName+"</td>"
					     +"<td>"+list[i].cardpName+"</td>"
					     +"<td>"+point[list[i].cardProperty]+"</td>"
					     +"<td><a  href='#' onclick='validateCheckBox(this)'>"+
					     flags[list[i].validStatus-1]+"<input hidden value="+list[i].id+">"+"</a></td>"
					     +"<td>"+list[i].cardValidTime+"</td>"
					     +"<td>"+flag[list[i].busAppFlag]+"</td>"
					     +"<td>"+flag[list[i].bicycleAppFlag]+"</td>"
					     +"<td>"+flag[list[i].libraryAppFlag]+"</td>"
					     +"<td>"+flag[list[i].smallConsumptionAppFlag]+"</td>"
					    /* +"<td>"+list[i].crtDate+"</td>"
					     +"<td>"+list[i].crtOperator+"</td>"
					     +"<td>"+list[i].lastDate+"</td>"
					     +"<td>"+list[i].lastOperator+"</td>"*/
					     +"<td style='display:none;'>"+list[i].cardpCode+"</td>"
					     +"<td style='display:none;'>"+list[i].id+"</td>"
					     +"</tr>"
			}
			
		}
		$("#productCard").html(content);
		/*$("input[name='numPerPage']").val(numPerPage);
		$("input[name='currentPage']").val(cuurentPage); 
		$("input[name='pageCount']").val(pageCount);*/
		$("input[name='numPerPage']").val(numPerPage);
		$("input[name='pageNum']").val(currentPage); 
		$("#totalCountByProduct").text("条，共"+totalCount+"条");
		/*var pagination="<a href='#' onclick="+"previous($('#getCardProduct'),getCardProductD) id='previous' >上一页  </a><a href='#' onclick="+"next($('#getCardProduct'),getCardProductD) id='next'> 下一页</a><span>当前第"+cuurentPage+"页，共"+pageCount+"页</span>";
		$("#paginationByProduct").html(pagination);*/
		$("#paginationByProduct").addClass("pagination").attr("targetType","navTab").attr("totalCount",totalCount).attr("numPerPage",numPerPage).attr("pageNumShown","10").attr("currentPage",currentPage).attr("rel","productCard").attr("callback","getCardProductD");
		$("div.pagination").each(function(){
			var $this = $(this);
			$this.pagination({
				targetType:"navTab",
				rel:"productCard",
				totalCount:totalCount,
				numPerPage:numPerPage,
				pageNumShown:10,
				currentPage:currentPage,
				callback:getCardProductD
			});
		});
		var $p = $("#ByCardProduct");
		initUI($p);
	});
  }
};

//-------获取修改的信息--------------------------------------------------------------------------------
function getUpdateProductt(json){
	if(json.statusCode==DWZ.statusCode.error){
		navTabAjaxDone(json)
	}else{
	$(json).each(function(n,item){
		//if(!item.sign){//修改是才执行回掉函数里面的内容
			var flag=["启用","未启用"];
			var point=["普通","特殊"];
			$("input[name='cardpName']").val(item.cpv.cardpName).attr("readonly","readonly");
			$("input[name='cardpCode']").val(item.cpv.cardpCode).attr("readonly","readonly");
			$("input[name='cardTypeName']").val(item.cardType.cardTypeName).attr("readonly","readonly");
			$("input[name='cardTypeCode']").val(item.cpv.cardTypeCode).attr("readonly","readonly");
			$("input[name='validStatus1']").val(flag[item.cpv.validStatus-1]).attr("readonly","readonly");
			$("input[name='validStatus']").val(item.cpv.validStatus).attr("readonly","readonly");
			$("input[name='cardProperty']").val(point[item.cpv.cardProperty]).attr("readonly","readonly");
			$("#descriptionByACP").val(item.cpv.description);
			//$("input[name='lastOperator']").val(item.activeUser.userNo);
			/*//20180317  惠国磊 以下  行   增加
			$("input[name='cardTCodeByUpdate']").val(item.cardTCodeByQuery);
			$("input[name='cardPCodeByUpdate']").val(item.cardPCodeByQuery);
			$("input[name='currentPageByUpdate']").val(item.currentPage);
			$("input[name='numPerPageByUpdate']").val(item.numPerPage);
			$("input[name='pageCountByUpdate']").val(item.pageCount);*/
			
			var validTime = item.cpv.cardValidTime;
			alert
			$("#cardValidTimeByACP option[value="+validTime+"]").attr("selected",true);
			
			var busAppFlag = item.cpv.busAppFlag;
			$("#busAppFlagByACP option[value="+busAppFlag+"]").attr("selected",true);
			
			var bicycleAppFlag = item.cpv.bicycleAppFlag;
			$("#bicycleAppFlagByACP option[value="+bicycleAppFlag+"]").attr("selected",true);
			
			var libraryAppFlag = item.cpv.libraryAppFlag;
			$("#libraryAppFlagByACP option[value="+libraryAppFlag+"]").attr("selected",true);
			
			var smallConsumptionAppFlag = item.cpv.smallConsumptionAppFlag;
			$("#smallConsumptionAppFlagByACP option[value="+smallConsumptionAppFlag+"]").attr("selected",true);			
			
			/*var contenta="";
				contenta+="<option value="+item.cpv.cardTypeCode+">"+item.cpv.typecode+"</option>";
				$("select#cardTypeCode").html(contenta);*/
		/*}else{
			
		}*/
	})
	}
}
//*******************卡业务参数*****************************************************
//获取卡产品信息回调函数
function getCardsBusiness(json){
	if(json.statusCode==DWZ.statusCode.error){
		navTabAjaxDone(json)
	}else{
	var content="";
	$(json).each(function(n,item){
		var numPerPage=item.numPerPage;
		var currentPage=item.currentPage;
		var totalCount=item.totalCount;
		var pageCount=item.pageCount
		var list=item.list;
		var flag = ["否","是"];
		if(list.length==0){
			content+="<tr><td colspan='8' align='center' >未查询到数据</td></tr>"
		}else{
			for(var i=0;i<list.length;i++){
				
				var value=list[i].cardpName+","+list[i].cardpCode+","+list[i].customerNo+","+list[i].isLoss+","+list[i].allowCoc+","+list[i].allowChc+","+list[i].isCardReturn;
				content+="<tr align='center'><td width='2%'><input name='Busiparatasked' onclick='test(this)' value="+value+" type='radio'></td>" +
				"<td>"+[i+1]+"</td>"+
				"<td>"+list[i].cardpName+"</td>" +
				"<td>"+flag[list[i].customerNo]+"</td>" +
				"<td>"+list[i].releaseDays+"</td>"+
				"<td>"+flag[list[i].isLoss]+"</td>" +
				"<td>"+flag[list[i].allowCoc]+"</td>" +
				"<td>"+list[i].cocReleaseDays+"</td>"+
			    "<td>"+flag[list[i].allowChc]+"</td>" +
			    "<td>"+list[i].chcReleaseDays+"</td>"+
			    "<td>"+flag[list[i].isCardReturn]+"</td>" +
			   /* "<td>"+list[i].crtDate+"</td>" +
			    "<td>"+list[i].crtOperator+"</td>" +
			    "<td>"+list[i].lastDate+"</td>"+
			    "<td>"+list[i].lastOperator+"</td>"+ */
			    "<td style='display:none;'>"+list[i].cardpCode+"</td></tr>" 
			}
			
		}
		$("#businessCard").html(content);
		/*$("input[name='numPerPage']").val(numPerPage);
		$("input[name='currentPage']").val(cuurentPage); 
		$("input[name='pageCount']").val(pageCount);*/
		$("input[name='numPerPage']").val(numPerPage);
		$("input[name='pageNum']").val(currentPage); 
		$("#totalCountByBusipara").text("条，共"+totalCount+"条");
		/*var pagination="<a href='#' onclick='previous()' id='previous' >上一页  </a><a href='#' onclick='next()' id='next'> 下一页</a><span>当前第"+cuurentPage+"页，共"+pageCount+"页</span>";*/
//		var pagination="<a href='#' onclick="+"previous($('#getCardBusinessInfos'),getCardsBusiness) id='previous' >上一页  </a><a href='#' onclick="+"next($('#getCardBusinessInfos'),getCardsBusiness) id='next'> 下一页</a><span>当前第"+cuurentPage+"页，共"+pageCount+"页</span>";
//		$("#paginationByBusipara").html(pagination);
		$("#paginationByBusipara").addClass("pagination").attr("targetType","navTab").attr("totalCount",totalCount).attr("numPerPage",numPerPage).attr("pageNumShown","10").attr("currentPage",currentPage).attr("rel","businessCard").attr("callback","getCardsBusiness");
		$("div.pagination").each(function(){
			var $this = $(this);
			$this.pagination({
				targetType:"navTab",
				rel:"businessCard",
				totalCount:totalCount,
				numPerPage:numPerPage,
				pageNumShown:10,
				currentPage:currentPage,
				callback:getCardsBusiness
			});
		});
		var $p = $("#ByCardBusinessPara");
		initUI($p);
	});
	}
};
//-------获取修改的信息--------------------------------------------------------------------------------
function getUpdateCardBusiParamInfo(json){
	if(json.statusCode==DWZ.statusCode.error){
		navTabAjaxDone(json)
	}else{
	$(json).each(function(n,item){
			$("#cardpCodeByABM").val(item.bp.cardpName).attr("readonly","readonly");
		    $("#cardpByABM").val(item.bp.cardpCode).attr("readonly","readonly");
		    $("#cardPCodeByQue").val(item.cardPCodeByQue);
		    //var contentc="";
		    var flag = ["否","是"];
		    /*alert(item.bp.customerNo);*/
		    if(item.bp.customerNo=="1"){
		    	$('#customerNo').find('option[value='+item.bp.customerNo+']').attr('selected','selected');
				}
		    if(item.bp.isLoss=="1"){
		    	$('#isLoss').find('option[value='+item.bp.isLoss+']').attr('selected','selected');
				}
		    if(item.bp.allowCoc=="1"){
		    	$('#allowCoc').find('option[value='+item.bp.allowCoc+']').attr('selected','selected');
				}else {
			   $("input[name='cocReleaseDays']").attr("readonly",true);	
			   $("input[name='cocTransferBalanceDays']").attr("readonly",true);	
				}
		    if(item.bp.allowChc=="1"){
		    	$('#allowChc').find('option[value='+item.bp.allowChc+']').attr('selected','selected');
				}else {
			   $("input[name='chcReleaseDays']").attr("readonly",true);
			   $("input[name='chcTransferBalanceDays']").attr("readonly",true);	
				}
		    if(item.bp.isCardReturn=="1"){
		    	$('#isCardReturn').find('option[value='+item.bp.isCardReturn+']').attr('selected','selected');
				}
            $("input[name='releaseDays']").val(item.bp.releaseDays);
		    $("input[name='chcReleaseDays']").val(item.bp.chcReleaseDays);
		    $("input[name='cocReleaseDays']").val(item.bp.cocReleaseDays);
		    $("input[name='chcTransferBalanceDays']").val(item.bp.chcTransferBalanceDays);
		    $("input[name='cocTransferBalanceDays']").val(item.bp.cocTransferBalanceDays);
		
	})
}
}
//获取窗口
function getOptionsSmall(){
	var options={"width":"500","height":"400"};
    return 	options;
}
function getOptionsMiddle(){
	var options={"width":"600","height":"500"};
    return 	options;
}
function getOptionsBig(){
	var options={"width":"1000","height":"560"};
    return 	options;
}
